Skip to main content

Full text of "TRS-80 Manual: ASMB-Z8 Z80 Cross Assembler for the Z8 Microprocessor (1980)(Allen Ashley)"

See other formats


ASMB-Z8 



Z80/8080 CROSS ASSEMBLER FOR THE 
ZILOG Z8 MICROPROCESSOR 



A disk-based assembler/ editor compatible with the 
ZILOG Z8 Instruction Set 



$75 



Copyright 1980 

Allen Ashley 
395 Sierra Madre Villa 
Pasadena, CA 91107 

(213) 793-5748 



ALLEN ASHLEY 

395 SIERRA MADRE VILLA • PASADENA. CALIFORNIA 91107 • (213)793-5748 



Dear User: 

I regret being unable to include a personal note. However, there are 
a few points which could not be covered in the documentation. 

First, I want you to be happy with this software package. If you have 
any difficulty — however slight — with either the documentation or the 
program, please contact me. I prefer to interact by telephone, but as time 
allows I will correspond by mail. 

Should program errors arise they will be repaired at no charge. I ask only 
that you return your original disk or cassette with proper packaging and a 
return manila envelope with sufficient return postage. 

Many of the best features of this software were suggested by users, and 
your comments and suggestions on the documentation or the program 
are welcome. Let's keep in touch. 



Sincerely, 
Allen Ashley 



r \ ( 



CONTENTS 



Bringing Up AS MB 1 

Introduction 2 

Interface to TRS DOS 3 

ASMB Organization 4 

Executive Commands 5 

Editor , 8 

Scrolling Program Output 8 

Assembler Operation 9 

Pseudo Operations * 10 

Assembler Errors /Diagnostics 12 

Sample ASMB Operation 13 

Instruction Set 



BRINGING UP ASMB 



1. 



Write protect the ASMB disk or cassette. 



2. Make a working copy of the master program; store the original as backup. 
The ASMB cassette loads at the 500 baud SYSTEM rate. 

3. Read the ASMB documentation. 

4. ASMB resides in memory immediately after the DOS. In the standard con- 
figuration the memory region from 5200H to 7800H is reserved for ASMB 
and assembler tables. Neither source nor object files can be located within 
this region without damage to the programs. 

5. Cassette Load Sequence: 

a. Enter ROM BASIC, with cassette 'L' (500 baud rate). 

b. Execute SYSTEM command. 



Respond to "*?" with 
AXnnnn 



where nnnn is the appropriate file name: 



AXCOP4 


AX2021 


AX8048 


AX2224 


AXZ8 


AX3870 


AX1802 





e. 



If the assembler is not to be saved on disk then you may branch directly: 

*? / 

If the assembler is to be saved on disk for later, more rapid access, 
use the TAPE utility. (The cassett load sequence over-writes the DOS. ) 
Follow this sequence: 

1. TAPE (S=T, B=D) 

2. CASS? L 

The program will be saved. 



INTRODUCTION 



ASMB is a powerful disk/tape based editor /assembler system for target processor 
program development on a TRS-80 microcomputer. 

ASMB includes all the features necessary for the creation, modification and storage 
of assembly language programs for the target processor. With minor exceptions, 
ASMB features instruction mnemonics identical to the manufacturer's instruction set. 

Programs developed with ASMB must be off-loaded for execution by the target pro- 
cessor. 



INTERFACE TO TRS DOS 



File names communicated to AS MB are terminated by a carriage return. The file 
name may be suffixed by an optional unit number. The unit number, if present, must 
be separated from the file name by a comma. File names not suffixed by a unit number 
default to drive 0. 

DISKFILE or 

DISKFILE, refer to file DISKFILE on drive 0. 

If a required file is not found in the directory, the file will be created; otherwise it will 
be overwritten. 

Assembly source files are automatically assigned an extension ASM. 

All programs use backspace (08) as character delete and BREAK (01) as abort. The 
Model I BREAK key may return to TRS DOS. In that event, ASMB must be patched to 
use an alternate ABORT key. Change locations 6714H and 5724H from 01 to your 
desired ABORT key.* One suggestion might be to change that value to IF and thereby 
use the CLEAR key as an abort. 



* For later versions of cross-assemblers ASMB-8051, -8070 and -TMS7, these two 
locations are 573C and 6809 respectively. 



ASMB ORGANIZATION 



The ASMB program development system consists of a combination text editor, assembler, 
and system executive for the creation and modification of assembly language programs. 

The system executive is responsible for handling all input /output operations, invoking 
the editor or assembler, and dealing with the disposition of source and object files in 
central memory. 

The text editor is responsible for the creation and modification of source programs 
within the memory file area. The text editor is line-oriented in that editing consists 
of entering or deleting source lines identified by ascending line numbers. The editor 
features automatic line numbering, line renumbering, moderately free-form source 
input, and well-formatted source output. 

The assembler performs a two-pass translation of source to object code. The assembler 
includes the powerful feature of conditional assembly. Instruction mnemonics are generally 
logically and syntactically identical to the manufacturer's instruction set. The assembler 
is file-oriented, with up to six source files simultaneously residing in memory. Optional 
symbol communication between files enables a moderate block structure development. 

Assembly language source programs are maintained in source files under control of 
the system executive. Source files are created and deleted by commands to the system 
executive. Source code is entered into the source files under control of the editor, and 
the assembler can be directed to translate the source file to object code anywhere in 
memory. 

The ASMB editor/assembler resides in memory immediately after the DOS. In the 
standard configuration, the memory region from 5200H up to 7500H is reserved for 
ASMB and assembler tables. Neither source nor object files can be located within this 
region without damage to the programs. 



EXECUTIVE COMMANDS 



COMMAND FORMAT 

Executive commands consist of a single letter identifier, together with an optional 
modifier character, and one or two hexadecimal parameters. The command character (s) 
must be separated from any numerical parameters by a single blank. Numerical para- 
meters are likewise separated by a blank. 

In the following, hexadecimal parameters are indicated by the sequence nnnn or mmmm 
while an optional character modifier is indicated by a lower-case c. Unless otherwise 
noted, the modifier c is a device control character (0-7), of which only (CRT) and 
1 (printer) are supported. 



COMMAND LIST 



F /NAME/ 

(Generic com- 
mand; specific 
examples 
below. ) 

F /NAME /nnnn 



F /OTHER/ 
F /ERASE /0 



Generic file control command. The file control command enables 
the user to create or destroy source files. Each source file is 
identified by a file NAME of up to five characters. The file name 
must be delimited by slashes. The opening slash must be separated 
by a blank from the command characters. There is no relation 
between memory file NAME and any disk file. 

Opens a source file NAME, starting at memory location nnnn, 
making NAME the active file. Any previously active files are main- 
tained. NOTE : no spaces after the /. 

Recall previously active file OTHER, making it the currently active 
file. Note that the hexadecimal parameter is absent. 

Delete file named ERASE, freeing memory space for a new source 
file. 



F 



Display the currently active file parameters, file name, starting 
and ending memory locations. 



FS 



Display the file parameters of all memory files. 



WT Write currently active source file to tape (500 baud).* 

WD Write currently active source file to disk. The executive will respond 

with the query FILE. The user must then type the disk file to receive 
the source. * 

RT Read source code from tape.* 

RD Read source code from disk into the currently active memory file. 

The executive responds with the FILE query.* 

CT n Append a source file from tape, renumbering source lines by increment n.* 

CD n Append a disk file to the currently active memory file, renumbering all 

source code lines by the increment n.* 

* Improperly formed operations, read errors, or insufficient disk file 
capacity result in the DISK ERROR or TAPE ERROR diagnostics. 

D nnnn mmmm Delete lines numbered nnnn up to and including mmmm from the 
source file. If mmmm is omitted only nnnn is deleted. 

B (BYE) Return to disk operating system. 

I Initialize the system, clearing all source files. The initialization 

is automatically performed upon initial entry. No lines of source 
code can be entered until a new source file has been defined. 

Pc nnnn *** Print a formatted listing of the current source file, starting at line 

number nnnn. ** 

Lc nnnn *** Print an unformatted listing (suppressing line numbers) of the current 

source file. ** 

** The optional modifying character, when present, can be the digit 1 
to direct output to list device. 

G nnnn Execute at location nnnn; used to enter an auxiliary program, such 

as a PROM burner. 

A nnnn mmmm*** Assemble the current source file using implied origin (ORG) nnnn 
and place the resulting object code into memory starting at location 
mmmm. The second parameter is optional; if absent, the object 
code is placed into memory at nnnn. 

If there is no ORG in your program, the first parameter acts as 
ORG nnnn in your program. The code will be assembled as if it is 
to run at location nnnn. Most applications, however, require an 
execution address in low memory, in conflict with the ROM of the 
TRS-80. The second parameter mmmm allows the code to be re- 

6 



positioned to available RAM. Thus 

A B000 

will assemble the code for execution at location (first parameter), 
and place the object code in memory at B000 (second parameter). 

Note that the source file address given in a previous F command 
does not appear in the A (assemble) command. 

AS Mark existing symbol table for future global reference. (Save 

symbol table resulting from last assembly. ) This command, if used, 
must follow an assembly: a symbol table must have been generated. 

AE nnnn mmmm Assemble, as above, displaying only source code lines containing 
an assembler diagnostic. 



AK 
AT 
E nnnn 



E /STRNG/ 



N nn 



Release (Mil) the global symbol table. 

Print symbol table resulting from previous assembly. 

Enter the mini-editor to edit the currently active source file begin- 
ning at line nnnn. The mini-editor enables the user to scroll 
through the source file, changing source lines on the fly. 

Upon entry, the mini-editor displays source line nnnn or the first 
source line if nnnn is omitted. The mini-editor then awaits keyboard 
input. Depressing any key except up-arrow (5BH) advances the file 
pointer to display the next successive line. The up-arrow allows the 
user to re-enter the source line starting at character position two. 
(At the label field, no line number is required. ) The user-entered 
line, terminated by a carriage return, then overlays the old line. 
The mini-editor cannot insert new source lines into the file. Return 
to system executive via BREAK. 

Enter the mini-editor to edit the currently active source file beginning 
at the first occurrence of character string STRNG. The string may 
be at most five characters long and may contain no blanks. The 
string search is operable for the P and L commands as well. 

Renumber source lines, starting at nn and incrementing by nn. 
The value nn is a decimal parameter. 



*** P, L and A command examples: A0 nnnn or Atf nnnn will send the output to the CRT. 

Al nnnn or A2 nnnn will send the output to a printer. 



EDITOR 



Source lines are entered into the currently active source file under control of the file 
editor. The system executive recognizes a source line by a four-digit decimal line 
number, which must precede every line in the source file. Modifications to the source 
file consist of one or more whole lines. Lines may be deleted by the D control command. 
Lines may be modified by retyping the line number and entering the new source line. 
The editor adjusts the source file to accommodate line length without any wasted file 
space. Character deletion is accomplished by the DELETE (—) key. 

Source program lines consist of a four-digit number followed by a terminating blank. 
The first character of the source line may contain identifiers "*" or ";". These 
identifiers proclaim the entire line to be a comment. The label field of the source 
line must be separated by exactly one blank from the line number. Identifying labels can 
be from one to five characters long and may contain no special characters. The 
operation field must be separated from the label field by one or more blanks. The 
operand field, if present, must be separated from the operation by a single blank. 
Two blanks following the last operand separate the comment field, which should start 
with a semicolon. Source lines may be up to 72 characters in length. 

The user can invoke automatic line numbering for lines entered into the source file. 
In the automatic mode, line numbers are incremented by one from the starting value. 
Automatic line numbering is initiated by entering the starting line number followed by 
> (greater than). Subsequent entries begin in character position two. The automatic 
mode is exited by typing < (less than) following the carriage return for the last source 
line - Failure to properly exit the automatic mode can result in erroneous source lines . 
Lengthy insertions can be made into an existing source file by renumbering the file 
before entering the automatic mode. 



SCROLLING PROGRAM OUTPUT 



The assembler allows the output to be scrolled. Pressing the space bar will freeze the 
display; any other key will resume scroll. Holding the space bar down progresses 
output at the repeat rate. 



ASSEMBLER OPERATION 



The assembler operates upon the currently active source file only. The source file 
consists of a sequence of source lines composed of the four fields: label, operation, 
operand, and comment. 

The label field, if present, must start in the second character position after the line 
number. Entries present in the label field are maintained in a symbol table. These 
entries are assigned a value equal to the program counter at the time of assembly, 
except that for the SET and EQU pseudo operations the variable defined by the label 
field is assigned the value of the operand field. The variables defined by the label field 
can be used in the operand field of other instructions either as data constants or locations. 

The operation field, separated from the label field by one or more blanks or a colon, 
cannot appear before the third character following the line number. Entries in the opera- 
tion field must consist of either a valid instruction or one of the several pseudo-operations. 

The operand field, separated by a blank from the operation field, consists of an arithmetic 
expression containing one or more program variables, constants, or the special character 
$, connected by the operators + or -. Evaluation of the operand field is limited to a left- 
to-right scan of the expression, using 16-bit integer arithmetic. Operations requiring 
multiple operands expect the operands to be separated by a comma. 

The special operand $ refers to the program counter at the start of the instruction being 
assembled. * The program variable $ can be used as any other program variable, except 
that its value changes constantly throughout assembly. The location counter $ allows the 
user to employ program-relative computations. 

Assembler constants may be either decimal or hexadecimal character strings. Valid 
hexadecimal constants must begin with a decimal digit, possibly 0, and be terminated 
by the suffix H. 

The individual bytes of a 16-bit operand may be accessed as 8-bit operands: 

VALUE !H is the high order byte 
VALUE ! L is the low order byte 

where VALUE is a 16-bit quantity and ! is the ASCII exclamation character with value 21H. 

Arithmetic expressions involving string operands must not begin with the string. Example: 

8 OH + 'A' is valid 
'A' + 80H is invalid 

A presentation of the target processor assembly language may be found in the appropriate 
programming manual. 



*NOTE: Some assemblers interpret $ as the start of the next instruction. 

9 



ASSEMBLER 
ORG expr 
DS expr 
DW expr 
DB expr 



EQU 



SET 



IF expr 



* ENDIF 
END 
USE operand 



PSEUDO OPERATIONS 

PSEUDO OPERATIONS (expr = arithmetic expression) 

Define program counter to nnnn. 

Reserve expr bytes of storage. 

16-bit datum definition. 

8 -bit datum or ASCII character string definition. The 
operand may be an ASCII character string enclosed in 
single quotation marks. Examples: 

DB 5,6,7 

DB 'ASCII STRING', 0DH, 0AH 

The operand defined by the label field is set equal to the 
expression defined by the operand field. This operation 
is performed in pass one of the assembly and the var- 
iable definition is fixed by the last such definition 
encountered. 

The operand defined by the label is set equal to the ex- 
pression defined by the operand field. This operation is 
performed in both pass 1 and pass 2 and the replacement 
is effected upon every encounter. 

expr is evaluated. If the result is zero the scanner skips 
to the next ENDIF, END, or end of file before resuming 
assembly. If the expression evaluates to any non-zero 
value, assembly proceeds. Operation is performed in both 
passes. 

Identifies the end of a conditional assembly block. 

Terminates assembly 

Allows program assembly to proceed with multiple location 
counters. The operation is skipped if the operand has not 
previously been defined. The USE operation is best explained 
by example: 



* Neither the IF nor NIF blocks preceding the ENDIF may contain comments 
containing the END or END! character sequences. 



10 



USE operand 
(cont'd) 



Example: 



A ORG SET 100H 
BORG SET 200H 
USE AORG; 

f code at 100H j 

USE BORG; 

f code at 200H j 
USE AORG; 

( code | 

USE BORG; 



SET code origin to AORG 



SET value of AORG to PC 
SET PC to BORG 



Resume code at end of 
previous block which started 
at 100H. 



Resume code at END of 
block which started at 200H. 



11 



ASSEMBLER ERRORS/DIAGNOSTICS 



Assembler error and diagnostic messages consist of single character identifiers 
which flag some irregularity discovered either during pass 1 or pass 2 of the 
assembly. The single character precedes the line number of the formatted 
assembly listing. 

P Phase error: the value of the label has changed between the two 
assembly passes 

L Label error: label contains illegal or too many characters 

U Undefined program variable 

V Value error: the evaluated operand is not consistent with the operation 

S Syntax error 

O Opcode error 

M Missing label field 

A Argument error 

R Register error 

D Duplicate label error 



12 



SAMPLE ASMB OPERATION 



, ASMB 



ASMB DEVELOPMENT SVSTEM 
F --TEST.-- 7500 
TEST 7500 7500 



0010 LOOP: 


I NX 1 


©Oil DAD 


B 


00 1 2 ORA 


A 


0013 JNZ 


LOOP 


0014 RET 




0015 




A AO00 




A00O 23 




AO01 09 




A092 B7 




A0O3 C2 OO AO 


A0S6 09 




SVMBOL TABLE 


LOOP A000 


WD 




FILE 




SAME WRITTEN 



Create memory file at 7500H 



> typed after line number, but not echoed 
Auto line mode 



< typed after carriage return 
Assemble file 







Assembly listing 


0010 


LOOP 


I NX 


H 


0011 




DAD 


B 


0012 




ORA 


A 


0013 




JNZ 


LOOP 


0014 




RET 





Write source to disk 
Disk operation completed 



13 



Z8 INSTRUCTION SET 



REGISTERS AND NOTATION 



The notation for operands (condition codes and address modes) and the actual operands 
they represent are as follows: 

Actual Operand/Range 

See condition code list below 



Notation 


Address Mode 


cc 


Condition code 


dst 


Destination register 


src 


Source register 


r 


Working register only- 


R 


Register or working regi! 


RR 


Register pair or working 




register pair 



Ir 
IR 
Irr 
IRR 

X 

DA 
RA 



Rn, where n = 0-15 



above 



Indirect working register 
only 

Indirect register or working 
register 

Indirect working register 
pair only 

Indirect register pair or 
working register pair 

Indexed 

Direct address 
Relative address 



IM 



Immediate 



reg , where reg is an even number in the 
range above or a variable whose address 
is even; RRp where p = 0, 2, 4, 6. . . 14 

@Rn, where n = 0-15 



@reg , where reg is as defined above; 
@Rn, as defined above 

@RRp , where p = 0, 2, 4, 6. . . 14 



@reg , where reg is an even number in 
the range above, or a variable whose 
address is even; @RRp as defined above 

reg(Rn) , where reg and Rn are as defined 
above 

Program label or expression 

Program label or $ + or - offset, where 
the location addressed must be in the 
range +127, -128 bytes from the start 
of the next instruction 

#data, where data is an expression 



4-1 



z8 



CONDITION CODES AND STATUS FLAGS 



Status flags are represented as follows: 



c 


Carry flag 


z 


Zero flag 


s 


Sign flag 


V 


Overflow flag 


D 


Decimal-adjust flag 


H 


Half-carry flag 



The condition codes and the flag settings they represent are: 



Code 


Meaning 


Flag Settings 


Value 







Always false 


_ 


0000 


(blank) 


8 


Always true 


- 


1000 


Z 


6 


Zero 


Z=l 


0110 


NZ 


E 


Not zero 


Z=0 


1110 


C 


7 


Carry 


C=l 


0111 


NC 


F 


No carry 


c=o 


1111 


PL 


D 


Plus 


s=o 


1101 


MI 


5 


Minus 


S=l 


0101 


NE 


E 


Not equal 


z=o 


1110 


OV 


4 


Overflow 


V=l 


0100 


NOV 


C 


No overflow 


v=o 


1100 


GE 


9 


Greater than or equal 


(S XOR V)=0 


1001 


LT 


1 


Less than 


(S XOR V)=l 


0001 


GT 


A 


Greater than 


(Z OR (S XOR V))=0 


1010 


LE 


2 


Less than or equal 


(Z OR (S XOR V))=l 


0010 


UGE 


F 


Unsigned greater than or 
equal 


C=0 


1111 


ULT 


7 


Unsigned less than 


C=l 


0111 


UGT 


B 


Unsigned greater than 


«C=0) & (Z=0))=1 


1011 


ULE 


3 


Unsigned less than or 
equal 


(C OR Z)=l 


0011 



Note that some of the condition codes correspond to identical flag settings, 
NZ-NE, C-ULT, NC-UGE. 



i.e. Z-EQ, 



4-2 



z8 



Z8 INSTRUCTIONS 





Addr Mode 


Opcode Byte 




Instruction 


dst 


src 


(Hex) 


Description 


ADC dst, src 


(Note 


1) 


ID 


Add with carry 


ADD dst, src 


(Note 1) 


OQ 


Add 


AND dst, src 


(Note 


1) 


5D 


Logical AND 


CALL dst 


DA 
IRR 




D6 
D4 


Call procedure 


CCF 






EF 


Complement carry flag 


CLR dst 


R 
JR 




BO 
Bl 


Clear 


COM dst 


R 
IR 




60 
61 


Complement 


CP dst, src 


(Note 1) 


AD 


Compare 


DA dst 


R 
IR 




40 
41 


Decimal adjust 


DEC dst 


R 
IR 




00 

or 


Decrement 


DECW dst 


RR 
IR 




80 
81 


Decrement word 


DI 






8F 


Disable interrupts 


DJNZ r, dst 


RA 




rA 


Decrement and jump if nonzero 


EI 






9F 


Enable interrupts 


INC dst 


r 
R 
IR 




rE 
20 
21 


Increment 


INCW dst 


RR 

m 




A0 
Al 


Increment word 


IRET 






BF 


Interrupt return 


JP cc.dst 


DA 
IRR 




CD 
30 


Jump 


JR cc.dst 


RA 




cB 


Jump relative 



4-3 



z8 



Instruction 



LD dst,src 



Addr Mode 
dst src 



LDRX dst, index, base 
LDXR base, index, src 

LDC dst, src 



LDCI dst, src 

LDE dst, src 

LDEI dst, src 

NOP 

OR dst, src 

POP dst 

PUSH src 

RCF 

RET 
RL dst 

RLC dst 

RR dst 

RRC dst 



r 

r 

R 

r 

Ir 

R 

R 

R 

m 

IR 

r 
X 

r 
Irr 

Ir 
Irr 

r 
Irr 

Ir 
Irr 



IM 

R 

r 

Ir 

r 

R 

IR 

IM 

IM 

R 

X 
r 

Irr 
r 

Irr 

Ir 

Irr 

r 

Irr 
Ir 



(Note 1) 
R 

m 



R 

m 



R 
IR 

R 

IR 

R 
IR 

R 
IR 



Opcode Byte 
(Hex) 

rC 

r8 

r9 

E3 

F3 

E4 

E5 

E6 

E7 

F5 

C7 
D7 

C2 
D2 

C3 
D3 

82 
92 

83 
93 

FF 

4Q 

50 
51 

70 
71 

CF 

AF 

90 
91 

10 
11 

E0 
El 

CO 
CI 



Description 

Load (except indexed) 



Load (indexed). These instructions 
replace the Zilog indexed load. 

Load constant 



Load constant autoincrement 

Load external data 

Load external data autoincrement 

No operation 
Logical OR 
Pop 

Push 

Reset carry flag 
Return 
Rotate left 

Rotate left through carry 

Rotate right 

Rotate right through carry 



4-4 



z8 





Addr Mode 


Opcode Byte 




Instruction 


dst src 


(Hex) 


Description 


SBC dst, src 


(Note 1) 


3D 


Subtract with carry- 


SCF 




DF 


Set carry flag 


SRA dst 


R 


DO 


Shift right arithmetic 




TR 


Dl 




SRP src 


IM 


31 


Set register pointer 


SUB dst, src 


(Note 1) 


2d 


Subtract 


SWAP dst 


R 


FO 


Swap nibbles 




m 


Fl 




TCM dst, src 


(Note 1) 


6Q 


Test complement under mask 


TM dst, src 


(Note 1) 


7D 


Test under mask 


XOR dst, src 


(Note 1) 


BD 


Logical exclusive OR 



NOTE 1 : These instructions have an identical set of addressing modes, which are 
encoded for brevity in this table. The higher opcode nibble is found in the instruction 
set table above. The lower nibble is expressed symbolically by a Q in the table, and 
its value is found in the following table to the right of the applicable addressing mode 
pair. For example, the opcode of an ADC instruction using the addressing modes 
r (destination) and Ir (source) is 13. 



Addr Mode 


Lower 


dst 


src 


Opcode Nibble 


r 


r 


H3 


r 


Ir 


HI 


R 


R 


a 


B 


IR 


E 


R 


IM 


m 


IR 


IM 


m 



4-5 



z8 



0060 
01300 

0002 

0004 
0007 
000fl 
00 0D 
0010 
0012 

0016 

0019 
00 IE 
001D 

001F 

0021 

0822 
0025 

002? 

0029 
002B 
002E 

0020 

0621 
0022 
0622 
0024 
0025 
0026 

0627 
002S 

002FI 

0O2C 
00 2 E 

0f40 

0042 
0044 

0046 

004 S 

004ft 

004C 
. 004E 

9050 

0052 
0054 
8056 
8053 
805ft 
005C 
805E 

0060 

8062 
8064 

8865 
8867 

8869 

88 6 C 
806E 

8871 
8074 



12 42 
12 42 

14 82 64 

15 02 04 

15 62 E4 

16 84 01 

16 E4 81 

17 84 81 
17 E4 01 
02 42 
52 42 
ft2 42 

42 42 

22 42 

62 42 

72 42 

B2 42 

D6 00 5E 

D4 E4 

EF 

8F 

9F 

EF 

FF 

CF 

ftF 

DF 
B0 84 

B0 E4 
El 04 
El E4 
60 E4 

40 E4 
00 E4 
50 E4 
70 E4 
90 E4 
10 E4 
E0 E4 
C0 E4 
D0 E4 
F0 E4 

80 E4 

81 E4 
81 04 
ft© E4 
6ft FE 
01=1 FC 
Fft Fft 

4E 

21 E2 
21 02 

5D 00 5E 

20 E4 
FD Q0 5E 

ED 00 5E 
DD 00 5E 



0010 ; WORKING REG 

0020 ftDC 

0020 ftDC 

0040 ftDC 

0050 ftDC 

0060 ftDC 

0070 ftDC 

0080 RDC 

0090 ftDC 

0100 ftDC 

8110 ADD 

0120 FIND 

0120 CP 

0140 OR 

0150 SBC 

0160 SUB 

0178 TCM 

0180 TM 

0190 XOR 

0200 CFILL 

0218 CftLL 

0220 CCF 

0220 D I 

0240 EI 

0250 I RET 

0260 NOP 

0270 RCF 

8280 RET 

0290 SCF 

8200 CLR 

0210 CLR 

0220 CLR 

0220 CLR 

0240 COM 

0250 Dft 

0260 DEC 

0270 POP 

0280 PUSH 

0290 RL 

0400 RLC 

04 10 RR 

042© RRC 

0420 SRft 

8448 SWBP 

8458 DECW 

8468 DECW 

0470 DECW 

0480 INCW 
0490 LOOP D.JN2 

05O0 D-JNZ 

0510 DJNZ 

0520 INC 

0520 INC 
0540 I NC 

8550 JP 

RP",h.Ft JP 

0570 JP 

0580 JP 
8598 JP 



ISTERS RN 8 LE N LE ±1 
R4, R2 
R4, ©R2 
4,2 
4, 02 
R4, 02 
4, #1 
R4, #1 
@4, #1 
@R4, #1 
R4, R2 
R4, R2 
R4, R2 

R4, R2 
R4, R2 
R4, R2 

R4, R2 
R4, R2 

R4, R2 

LOOP 

©RR4 



Z8 

ASSEMBLER TEST 
PROGRAM 



4 

R4 

04 

0R4 

R4 

R4 

R4 

R4 

R4 

R4 

R4 

R4 

R4 

R4 

R4 

RR4 

0R4 

04 

RR4 

R6, LOOP 

R8, LOOP 

R15, LOOP 

R4 

0R2 
02 

HI, LOUP 

0RR4 
NC, LOOP 

NZ, LOOP 
PL, LOOP 



4-6 



0877 


4D 80 


5E 




0600 


JP 


OV, LOOP Z8-2 


087R 


6D 68 


5E 




0610 


JP 


EQ, LOOP 


08 7 D 


ED 80 


5E 




0620 


JP 


NE, LOOP 


G8S8 


3D 00 


5E 




0620 


JP 


GE, LOOP 


' *S'2 


2D 00 


5E 




0640 


JP 


LE, LOOP 


v. -86 


ID 08 


5E 




0658 


JP 


LT, LOOP 


08 S3 


FID 00 


5E 




8660 


JP 


GT, LOOP 


08 SC 


5B D8 






0670 


JR 


MI, LOOP 


88SE 


4C 81 






0680 


LD 


R4, #1 


8838 


48 62 






0630 


LD 


R4, 2 


8832 


23 84 






0700 


LD 


4, R2 


8894 


E2 42 






8710 


LD 


R4, <?R3 


0836 


F2 42 






0728 


LD 


@R4, R2 


08 3 S 


E4 02 


04 




0720 


LD 


4, 2 


083B 


E5 E2 


04 




0740 


LD 


4, @R2 


083 E 


E6 84 


81 




0758 


LD 


4, #1 


08fil 


E7 84 


01 




0768 


LD 


C"4, #1 


88R4 


F5 84 


04 




0770 


LD 


@4, 4 


08R7 








0780 


; BELOW ARE 


THE INDEXED LORDS 


88R7 


C7 R8 


F0 




0790 


LDRX 


RIO, R0, 248 i IS 


88RR 


D7 ft© 


F0 




0800 


LDXR 


248, R8, R18 ; I : 


88RD 


C2 24 






0818 


LDC 


R2, ©RR4 


88RF 


D2 42 






8820 


LDC 


@RR4, R2 


08E1 


82 24 






0820 


LDE 


R2, C-RR4 . 


08B2 


02 24 






0840 


LDC I 


©R2, 0RR4 


88B5 


D2 42 






0858 


LDC I 


8RR4, §R2 


08B7 


82 24 






8860 


LDE I 


©R2, ©RR4 


68B9 


50 E4 






0878 


POP 


R4 


88BB 


50 04 






0880 


POP 


4 


08BD 


51 04 






8890 


POP 


©4 


pcigp 


51 E4 






0900 


POP 


§R4 


Ci 


78 04 






8318 


PUSH 


4 


88C2 


21 88 




t M i 


£1328 


SRP 


12 


08C5 


21 78 






8328 


SRP 


78H 


88C7 








8948; 


; RELfi LIMIT 




8QC7 








8358.; 


} NOTE fflT 


REFERS TO STRRT 


88C7 


6fl 00 




v 


8368 


DJNZ 


R6, f-128 


w8C3 


6R 88 




v 


8378 


DJNZ 


R6, *-127 


88CB 


6fl 88 






8388 


DJNZ 


R6, *-126 


08 CD 


6fl 7E 






0338 


DJNZ 


R6, $+128 


08CF 


6fl 7D 






1888 


DJNZ 


R6, * +127 


W0D1 


6fl 7F 






1818 


DJNZ 


R6, f+123 


8SD2 


6fi 80 




\! 


1828 


DJNZ 


R6, $+128 


08D5 








1828 


.; END RELRTIV 


'E JUMPS 


88D5 








18--10 


; ERROR CHECK 


.~* 


88D5 


12 44 




R 


1858 


RDC 


R4, RR4 ; NO RR 


08D7 


12 44 




R 


1868 


RDC 


RR4, R4 


88 D 3 


12 04 




C; 


1878 


RDC 


R16, R4 


88DB 


D4 E4 






1888 


CALL 


8R4 


88DD 


D6 00 


80 


u 


1030 


CRLL 


RR4 


Q8E8 


Bl E4 






1188 


CLR 


8RR4 


08E2 


88 E4 






1118 


DECW 


R4 


88 E 4 


81 E4 






1128 


DECW 


8RR4 


88 E 6 


28 IE 






1128 


INC 


20 


88ES 


21 88 




R 


1148 


INC 


8RR4 


U8ER 


8D 88 


Efl 


U 


1158 


JP 


NO, * 


08ED 


E6 E4 


64 


' ? 


1168 


LD 


RR4, ttl88 


"'F0 


E6 64 


64 


-• 


1178 


LD 


#188, #188 


...8F2 


E6 E4 


E4 


R 


1188 


LD 


R4, 8RR4 


88F6 


C2 E4 




R 


1198 


LDC 


28, 8RR4 


88FS 


C2 4E 




R 


1288 


LDC 


£RR4, 28 


08Ffl 


82 E4 




R 


1218 


LDE 


28, 8RR4 



LD R18, 246<R0> 
:. LD 240"CR0>, R10 



OF DJNZ INSTRUCTION 



4-7 



0OFC 82 4E R -1 ??fl LDE 0RR4, 38 Z8-3 

00FE 51 : E4 
0190 56 E4 
0102 21 06 
SVMBOL TflBbE 
LOOP 005E 



1220 


LDE 


©RR4, 


1220 


POP 


C-RR4 


1249 


POP 


RR4 


1250 


SRP 


_<. 



4-8 



< * 
H g 
</) |f 

9 

O E 

O I 







< 
z 

LU 



■ ■ 9 



e»|i 



£ a w 

ill 
ib 

s s 

'it 



D C 

» m 

n 

•s B 



§■; - *y 

* B #1 _ nn 

a s f S3 

£ He E5 

SIN* 

a |-s2 fc 



f 



I 

I: 

1 ■ 



< W 

F ! F 

HOD. 




s 

o 
1 

8.3 



Si" 

« 8 

C a 

s • 

I 

£| 

II 

" a 



t 4 



i: 



u 

E s 



8. 



!h]i 

qi ji 

s ^ " g 5 I 

a r, u ™ S ■*. 



£*« 



If 

= J R - 8 B 
| ^ g E I E 

= O — 5 (J EX 

slliiis 

S S ° * E i 

£ gl | 8 j<£ 
- " «| 8 E. * 

J8£ « II gl 

H f- U V • 5 D 





s 
c 

z 

o 

£ 

P 

O 

w 

o 



< 
DC 

* 

cc 



) t * ■ 1 » * T3 

Ii 1 !'!!! 

El< H " s 5 * - 
|J L> t £ ii 

i a 

1 



K 

f- 

•■eg 



u l fe * ■< * - 

' % * g k - 
■ • it- 

* t b • „ „ . . 
**|S S b 

1"= III : 

■* ^ ■« St P "^ 5 

>-£a w £A- J ac 

I 5 = ^ | -g »| . 

Et<T" E ?b* 

SrK^w E* ^ta- fi 

*>< .«t'^ l "tj<-' 
5 ^ «° ■„-e - E^r 

c . . ^ n — _ "T- ..... 





5 

*S°fc. , - K o — 



li Si* 




« 41 k 

Sf I 

ii: 

V V ° 

1 V I 
U i] < 

I H a 

I E 
ill 



U 

o 



OOOOOOifliAQOiA 
W W W M N — (M csl <N >-• 






Si M * * * * M 

u u u u u u u 

g g£££2i£ ££ • ■ « 

o oP.ttb3,P.b do o 
ZZb.h.d.b.b.&Hb.KEIZ 




: » . = 



Sill 

h 1 c a 



C O M „ 



< 2 fc h. S 



<3<JEOfc 
tin h hJ h bi 2 



I 



5 






!i 



F *» 






» ■ 

1 s 



ii 



IS 

si 



en: 



im 



□ en 



D 

i 



Is 



a 



a. 
a 
a 
< 



I* 

to a 



3 % 

i 



2 1 



i ■ ■ 
S V I 



8 8.. 

x ^ a 

c t > 



5 X 



* * *? 



■ ■ s c y. c. 

5 ^ 



r I 


1 


— 1 


q 


1 1 


' 


1 


V 


o 

EC 


f 




1 

S 




T 






0= N 


0. 




O 







m 


v. 


as — 


u 


N 


i 


** ** 


" 


"■* 








u 












a. 


«e 




» ~- 


V 




,J= 


X £ 


1 


£ 


t 


u u 


u 


UJ 


£ 


»- f- 


h 


F- 


W2 « 


vl 


n 


u 


J- s- 


>■ 


> 


u: en 


en 


en 


K 

DC 
< 



o _ ■ — 

=■¥* I 

8 ■ t if 

£■ a o — 



- C i 

E I 



5" 

U — 

as 



j; it — -: 



It. 

I s 

£ 5 



5 B 



§l£ 



re 


VI 


VI 




w 




^ 


„ 


_1 






:_> 


E 


ti 


Q 


C 


C 


K 


? 


7 


rr 






< 


U 


u 


O 


u 


u 














^ 




C 




W 


K 



> - 

•J ffl 

■o 

5 < 

£ s 

its" 
- Si 



i 

u 



S 
a, 
C 

u 
> 
w 
□ 



en 

o 



s 

■e,. 

X : 



I 



g 1 

1 



2 ». js 



s s 

J3 ■ 



- -3 

II 



it 

S ft 

£ 

* s 

1 5 

So 



■ > 

b J 






II 

o E 

= g 



1 2 i 






o a 

E So 

E S 



2 ; 




a, 

(/> 
K 

HI 

_1 

m 

S 

UJ 
V) 
CO 

< 

(A 
O 

£C 
O 



a I * 

■ fe H 

3 ■ 



fl £ 



|m g 

5£ £ 

a s K 

5. « ■ 

o 5 ii 

b L. 

ii s « 

% Is 

* ■ u 

• 1 - 

fee 9 

| | z 



a a 

S o 



11 



Co - 

V ao 



v " e I * 

Ih ^ fl (• n 

e a u !! • 

111 

BsiH 

£ -z a £ 1 
1 E js S ■ 

* alii 

9 c C c 

[Jill 

1,81 II S 



its 

?"< 

S. &o 

J = E 

> 5 ■ 

X - ' 

D js N 



1 



^:^ £ 



ilE 

„ ■ * 
i|j 

■ 

111 

o I £ 



Mil* 



a s 



si : 

• *- -— 

u u C 

£ £ -* 

12b 

ii S H 



V £ ■ h 

p c E r 4> 

l fl j 5 

s E ■ y a 

> m v ■ _ 

« BS I- ■— 



3 4 






!tSi 

£ E ■ £ 

« E o « 

• o £ ■ 

a> ■« <d ^ 

B J6| 

*. 2 ™ « 

1 i ■ t 

1 iff 

issi 

ii,*) 

• I B * 

I'M 

ill 

*j «w T3 



ii 

< «■ 






ll 



.Ell 

! i I I 

* Qi a, 
* M O _ 

t S 1 3 

£ E z N 



O O O D 

b. h h h 



u u w w 
« « m « 

■ H H H 



ii 



H 



a. m 






11 



■ 1 



a E